home *** CD-ROM | disk | FTP | other *** search
- #ifndef _TEXTVIEW_
- #define _TEXTVIEW_
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- #ifndef __CONTROLS__
- #include <Controls.h>
- #endif
-
- #ifndef __WINDOWS__
- #include <Windows.h>
- #endif
-
- #ifndef __PRINTING__
- #include <Printing.h>
- #endif
-
- #define kTextViewMargin 4
- #define kScrollBarThickness 15
- #define kHScrollAmount 20
-
- #define kPrintHeaderStyle (bold+italic)
-
-
- typedef struct TTextLineInfo TTextLineInfo,*TTextLineInfoPtr,**TTextLineInfoHandle;
- struct TTextLineInfo
- {
- unsigned long fOffsetFromTextStart;
- short fLineLength;
- Style fTextStyle;
- unsigned long fRefCon;
- };
-
- typedef struct TTextView TTextView,*TTextViewPtr,**TTextViewHandle;
- struct TTextView
- {
- WindowPtr fWindow;
- Boolean fActive;
- Rect fViewRect;
- Rect fTextSizeRect;
-
- unsigned long fSelectionStart;
- unsigned long fSelectionEnd;
-
- unsigned long fTopLine;
- unsigned long fLineCount;
- TTextLineInfoHandle fTextLineInfoArrayHandle;
- Handle fTextHandle;
-
- ControlHandle fVerticalScroll,fHorizontalScroll;
- };
-
-
- TTextViewHandle NewTextView(WindowPtr theWindow,Rect *viewRect);
- void DisposeTextView(TTextViewHandle theTextView);
-
- void UpdateTextView(TTextViewHandle theTextView,RgnHandle updateRgn);
-
- void PrintHeader(Rect *pageRectangle,StringPtr documentName,short pageNum,short baseLine);
- void PrintPages(short fontNum,short fontSize,TPPrPort thePrPort,Rect *pageRectangle,StringPtr documentName,TTextViewHandle theTextView);
- void PrintTextView(THPrint printRecord,StringPtr documentName,TTextViewHandle theTextView);
-
- void ActivateTextView(TTextViewHandle theTextView,Boolean activating);
- void ResizeTextView(TTextViewHandle theTextView,Rect *newSize);
-
- Boolean ClickTextView(TTextViewHandle theTextView,Point where,long *lineHit,Boolean isDoubleClick);
- unsigned long GetTextLineRefCon(TTextViewHandle theTextView,long theLine);
- void SelectLine(TTextViewHandle theTextView,long lineHit);
-
- void SetTextViewSelection(TTextViewHandle theTextView,unsigned long selStart,unsigned long selEnd);
- void GetTextViewSelection(TTextViewHandle theTextView,unsigned long *selStart,unsigned long *selEnd);
- void CopyTextViewSelectionToScrap(TTextViewHandle theTextView);
-
- void AddStringToTextView(TTextViewHandle theTextView,Str255 theTextToAdd,Style theTextStyle,long refCon);
-
- void ScrollTextView(TTextViewHandle theTextView,unsigned long newTopLine);
-
-
- #endif
-